package tvv.levelup.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tvv.levelup.dao.EquipmentDao;
import tvv.levelup.dao.IEquipmentDao;
import tvv.levelup.models.Equipment;

/**
 * Created by VLAD on 03.09.2014.
 */
@Service
public class EquipmentService implements IEquipmentService {

    @Autowired
    private IEquipmentDao equipmentDao;

    @Override
    public Equipment getEquipmentById(int id) {

        return equipmentDao.getEquipmentById(id);
    }

    @Override
    public Equipment saveEquipment(String name) {
        int id = equipmentDao.getActualEquipmentId();
        Equipment eq = new Equipment();
        eq.setId(id);
        eq.setName(name);
        equipmentDao.saveEquipment(eq);

        return eq;
    }

}
